<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="/WEB-INF/tld/jmesa.tld" prefix="jmesa" %> 
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   
    <title>全过程管理</title>
    <script type="text/javascript" src="/estate/js/jquery-1.2.2.pack.js"></script>
    <script type="text/javascript" src="/estate/js/jquery-1.3.min.js"></script> 
    <script type="text/javascript" src="/estate/js/jquery.jmesa.js"></script>
    <script type="text/javascript" src="/estate/js/jmesa.js"></script>              
    <link rel="stylesheet" type="text/css" href="/estate/css/jmesa.css"></link>
    <link rel="stylesheet" type="text/css" href="/estate/css/css.css"></link>
    <script type="text/javascript">
    	function selectAllItems() {
    		var cbArray = document.getElementsByName("cbMulti");
    		var all = document.getElementById("cbAll").checked;
    		for(var i = 0;i<cbArray.length;i++){
    			if(all){
    				cbArray[i].checked = true;
    			}else{
    				cbArray[i].checked = false;
    			}
    		}

		} 
		function enterMultiType(form){
			window.location.href="/estate/admin/manageProAction.action?method=track&multiType=true";
		}
		function enterSingleType(form){
			window.location.href="/estate/admin/manageProAction.action?method=track&multiType=false";
		}
		
		function multiPush() {
		
		question=confirm("确定批量推进项目？");
		if(question!=0){
		var cbArray = document.getElementsByName("cbMulti");
			var pushStr = "";
			for(var i = 0;i<cbArray.length;i++){
    			if(cbArray[i].checked){
    				pushStr = pushStr+cbArray[i].value+",";
    			}
    		}
			window.location.href="/estate/admin/multiOperationInManageProAction.action?currentPage=proTrackList&operationType=multipush&stepStr="+pushStr;
		}
	    }
	    
	    function multiBack() {
		
		question=confirm("确定批量倒退项目？");
		if(question!=0){
		var cbArray = document.getElementsByName("cbMulti");
			var backStr = "";
			for(var i = 0;i<cbArray.length;i++){
    			if(cbArray[i].checked){
    				backStr = backStr+cbArray[i].value+",";
    			}
    		}
			window.location.href="/estate/admin/multiOperationInManageProAction.action?currentPage=proTrackList&operationType=multiback&stepStr="+backStr;
		}
	    }
		
		function pushConfirm(id){
			question=confirm("确定推进此项目？");
			if(question!=0){
				window.location.href="/estate/admin/manageProAction.action?method=push&id="+id;
			}
		}
		
		function backConfirm(id){
			question=confirm("确定倒退此项目？");
			if(question!=0){
				window.location.href="/estate/admin/manageProAction.action?method=back&id="+id;
			}
		}
    
        function showNewProject(showUrl){
    	window.location.href=showUrl;
        }
	</script>
	<style>
		#lightbox-content{position:absolute;height:420px;width:820px;margin:-250px 0px 0px -250px;top: 50%;left: 30%;text-align: center;background-color: #FFF;border: 1px solid #000;display:none;z-index:100;overflow:hidden;padding:10px 10px 40px 10px;}
		#lightbox-content p{ margin-top:8px;}
		#lightbox-bg{position:absolute;top:0;left:0;z-index: 90;background:#000;display:none;width:100%;height:100%;_height:2000px;filter:alpha(opacity=70);-moz-opacity:0.6;opacity:0.6;}
	</style>
  </head>
 
  <body>
    <table border="0" cellpadding="0" cellspacing="0" style="background-image:url(/estate/images/gtbg.gif) " width="100%">
    <tr>
      <td width="50%" height="82" rowspan="2"><img src="/estate/images/guide_01.gif"></td>
      <td width="50%" style="background-image:url(/estate/images/guide_02.gif);color:#cc1212; font-size:16px; font-weight:bold; text-align:right; padding-right:50px; letter-spacing:1px; " height="39"><strong>项目处理</strong></td>
    </tr>
     <tr><td width="50%" style="background-image:url(/estate/images/guide_03.gif); height:43px;" align="center" valign="middle">
	  <table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr align="center">
         <c:if test="${requestScope.multiType != null}">
          	<c:if test="${requestScope.multiType}">
          		<td><input name="Submit1" type="button" onclick="enterSingleType(manageProTrackForm)" onFocus="this.blur();" class="button4" value="单选模式" > </td>
          		<td><input name="Submit1" type="button" onclick="multiPush()" onFocus="this.blur();" class="button4" value="批量推进" > </td>
          		<td><input name="Submit1" type="button" onclick="multiBack()" onFocus="this.blur();" class="button4" value="批量倒退" > </td>
          	</c:if>
          </c:if>
           <c:if test="${requestScope.multiType == null or !requestScope.multiType}">
          	<td><input name="Submit1" type="button" onclick="enterMultiType(manageProTrackForm)" onFocus="this.blur();" class="button4" value="批量模式"> </td>
          </c:if>
        </tr>
      </table></td>
    </tr>
</table><br>
  <form id="manageProTrackForm"  name="manageProTrackForm" >
  <div align="center" >
	<div class="main" align="center" style="width:100%;height:400px;background-color: white;">
  
      <jmesa:struts2TableModel items="${manageProListInTrack}" id="manageProListInTrackTable" var="bean" stateAttr="restore" editable="true" exportTypes="excel"  toolbar="com.estate.utils.JmesaToolBarPage">
          <jmesa:htmlTable style="text-align:center;" width="100%" caption="<div style='height:20px;text-align:center;'>项目追踪</div>">
              <jmesa:htmlRow uniqueProperty="id">
               <c:if test="${requestScope.multiType != null and requestScope.multiType}">
	              	  <jmesa:htmlColumn editable="false" sortable="false" property="checkbox" title="<input id='cbAll' name='cbAll' type='checkbox' onclick='selectAllItems()'>全选/全不选</input>" ><input type="checkbox" id="cbMulti" name="cbMulti" value="${bean.id }"/></jmesa:htmlColumn>
               </c:if>
                  <jmesa:htmlColumn title="序号" property="id" editable="false"/>
                  <jmesa:htmlColumn title="项目编号" property="proNum" editable="false" sortable="true"/>
                  <jmesa:htmlColumn title="项目名称" property="proName" editable="false" sortable="true"/>
                  <jmesa:htmlColumn title="项目联系人" property="contactName" editable="false"/>
                  <jmesa:htmlColumn title="项目办理人" property="manageUser.name" editable="false"/>
                  <jmesa:htmlColumn title="咨询人员" property="consultName" editable="false"/>
                  <jmesa:htmlColumn title="项目登记日期" property="recordDate" editable="false" sortable="true"/>
                  <jmesa:htmlColumn title="项目状态" property="state" editable="false">
                  <c:if test="${bean.state == 0 }">
                   <label>未发布</label>
                  </c:if>
                  <c:if test="${bean.state == 1 }">
                   <label>已发布</label>
                  </c:if>
                  </jmesa:htmlColumn>
                  
                  <jmesa:htmlColumn title="当前步骤" property="currentStep" editable="false">
                  <c:if test="${bean.currentStep == 0 }">
                   <label>拟定批准</label>
                  </c:if>
                  <c:if test="${bean.currentStep == 1 }">
                   <label>实施管理</label>
                  </c:if>
                  <c:if test="${bean.currentStep == 2 }">
                   <label>审计总结</label>
                  </c:if>
                  </jmesa:htmlColumn>
                  <jmesa:htmlColumn title="操作" style="align=left"  editable="false">
                  <a href="/estate/admin/manageProAction.action?method=detail&id=${bean.id}">查看</a>&nbsp;&nbsp;
                  
                  <c:if test="${bean.currentStep == 0 }">
                   <a onclick="pushConfirm(${bean.id})" style="cursor: pointer">推进</a>&nbsp;&nbsp;
                  </c:if>
                  
                  <c:if test = "${bean.currentStep == 1 }">
                  <a onclick="pushConfirm(${bean.id})" style="cursor: pointer">推进</a>&nbsp;&nbsp;
                  <a onclick="backConfirm(${bean.id})" style="cursor: pointer">倒退</a>&nbsp;&nbsp;
                  </c:if>
                  
                  <c:if test = "${bean.currentStep == 2 }">
                  <a onclick="backConfirm(${bean.id})" style="cursor: pointer">倒退</a>&nbsp;&nbsp;
                  </c:if>
                  
                  </jmesa:htmlColumn>
                   
              </jmesa:htmlRow>
          </jmesa:htmlTable>
      </jmesa:struts2TableModel>
      
       </div>
  </div>
  </form>
  </body>
</html>